﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	调节水池
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dolphincontainer">
	    <div id="dolphinnav">
	        <ul>
	            <li><a href="/Stack/Index"><span>堆场管理</span></a></li>
                <li><a href="/Stack/Edit/<%:ViewData["id"] %>"><span>基本信息</span></a></li>
                <li><a href="/Stack/Weather/<%:ViewData["id"] %>"><span>气象信息</span></a></li>
                <li><a href="/Stack/Stack/<%:ViewData["id"] %>"><span>堆场信息</span></a></li>
                <li><a href="javascript:return(false);" class="current"><span>调节水池</span></a></li>
                <li><a href="/Stack/Material/<%:ViewData["id"] %>"><span>材料信息</span></a></li>
                <li><a href="/Stack/Settle/<%:ViewData["id"] %>"><span>沉降模型</span></a></li>
	        </ul>
	    </div>
	</div>

    
    <% 
    Return_Water_Pond_Base_Info[] pools = (Return_Water_Pond_Base_Info[])ViewData["pools"];
    int poolNum = pools.Length;

    Runoff_Interception_Ditch_Base_Info[] ditches = (Runoff_Interception_Ditch_Base_Info[])ViewData["ditches"];
    int ditchNum = ditches.Length;
    using (Html.BeginForm())
    {
    %>
        <%: Html.ValidationSummary(true) %>
        <%: Html.Hidden("id", (int)ViewData["id"])%>
        <%
           bool result = (bool)ViewData["success"];
           if(result){ 
        %>
           <div style="text-align:center;margin-top:20px;font-weight:bold;color:blue">调节水池、截洪沟更新成功</div>
        <%
        }
        %>
    <div style="margin-left:10px;margin-top:5px;font-size:14px;font-weight:bold">调节水池<input style="margin-left:20px" type="button" value="增加调节水池" onclick="addPool();" /></div>      
          
    <table class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:10px">
        
        <tr class="row1">
            <td id="pools">
                <%
                int i = 0;
                string[] poolElArray = (string[])ViewData["poolElArray"];           
                foreach (Return_Water_Pond_Base_Info pool in pools)
                {
                %>
                <table id="pool<%:i + 1 %>" class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:5px;margin-bottom:5px">
                    <tr>
                    <th colspan="4"><%: i + 1 %>号调节水池<%if (i > 0) { %><a style='float:right;margin-right:5px' href="javascript:void(0);" onclick="removePool(<%:i + 1 %>);">X</a><%} %></th>
                    </tr>
                    <tr>
                        <td class="row1" align="right" width="150px">底部高程</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("base_El" + (i + 1) , pool.base_El)%>
                        </td>
                        <td class="row1" align="right" width="150px">底部面积</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("base_area" + (i + 1), pool.base_area)%>
                        </td>
                    </tr>
                    <tr>
                        <td class="row1" align="right">顶部高程</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("top_EL" + (i + 1), pool.top_EL)%>
                        </td>
                        <td class="row1" align="right">顶部面积</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("top_area" + (i + 1), pool.top_area)%>
                        </td>
                    </tr>
                    <tr>
                        <td class="row1" align="right">平均面积</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("middle_avg_water_area" + (i + 1), pool.middle_avg_water_area)%>
                        </td>
                        <td class="row1" align="right">平均边坡面积</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("avg_slope_HDPE_area" + (i + 1), pool.avg_slope_HDPE_area)%>
                        </td>
                    </tr>
                    <tr>
                        <td class="row1" align="right">最小深度</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("Min_Depth" + (i + 1), pool.Min_Depth)%>
                        </td>
                        <td class="row1" align="right">平均深度</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("Avg_Depth" + (i + 1), pool.Avg_Depth)%>
                        </td>
                    </tr>
                    <tr>
                        <td class="row1" align="right">平均最大深度</td>
                        <td class="row1" align="left">
                            <%: Html.TextBox("Avg_Depth_max" + (i + 1), pool.Avg_Depth_max)%>
                        </td>
                        <td class="row1" align="right">&nbsp;</td>
                        <td class="row1" align="left">&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="row1" align="right">高程-面积数据</td>
                        <td class="row1" align="left">
                            <%: Html.TextArea("El_areas" + (i + 1), poolElArray[i], new { cols = "15", rows = "12" })%>
                        </td>
                        <td class="row1" align="right">&nbsp;</td>
                        <td class="row1" align="left">&nbsp;</td>
                    </tr>
                </table>
                <%
                    i++;
                }
                %>
            </td>
        </tr>
    </table>

    <div style="margin-left:10px;margin-top:15px;font-size:14px;font-weight:bold">截洪沟<input style="margin-left:20px" type="button" value="增加截洪沟" onclick="addDitch();" /></div>      
          
    <table id="ditches" class="tableCss" cellspacing="0" cellpadding="0" align="center" border="0" style="margin-top:10px">
        <%
        i = 0;
        foreach (Runoff_Interception_Ditch_Base_Info ditch in ditches)
        {
             i++;
         %>
        <tr class="row1" id="ditch<%:i %>">
            <th class="row1" style="padding-left:15px">第<%: i %>号截洪沟</th>
                    
            <td class="row1" style="padding-left:15px">高程</td>
            <td class="row1"><%: Html.TextBox("ditch_El" + i, ditch.El)%></td>
            <td class="row1">面积</td>
            <td class="row1"><%: Html.TextBox("ditch_Area" + i, ditch.Area)%></td>
            <td class="row1">&nbsp;<%if (i > 1) { %><a style='float:right;margin-right:5px' href="javascript:void(0);" onclick="removePool(<%:i %>);">X</a><%} %></td>
         </tr>
         <%} %>
      </table>
                
       
    <div style="margin-top:25px;text-align:center">
        <%: Html.Hidden("totalPoolNum", poolNum)%>
        <%: Html.Hidden("totalDitchNum", ditchNum)%>
        <input type="submit" value="提    交" style="font-size:16px;font-weight:bold" />
    </div>
    <% } %>

    <script type="text/javascript"" language="javascript">
        var poolNum = <%: poolNum%>;
        function getInnerHtml(poolNo)
        {
            var htmlStr = "<table id='pool" + poolNo + "' class='tableCss' cellspacing='0' cellpadding='0' align='center' border='0' style='margin-top:5px;margin-bottom:5px;'><tr><th colspan='4'>" + poolNo + "号调节水池<a style='float:right;margin-right:5px' href='javascript:void(0);' onclick='removePool(" + poolNo + ");'>X</a></th></tr><tr><td class='row1' align='right' width='150px'>底部高程</td><td class='row1' align='left'><input type='textbox' name='base_El" + poolNo + "' value='' /></td><td class='row1' align='right' width='150px'>底部面积</td><td class='row1' align='left'><input type='textbox' name='base_area" + poolNo + "' value='' /></td></tr><tr><td class='row1' align='right'>顶部高程</td><td class='row1' align='left'><input type='textbox' name='top_EL" + poolNo + "' value='' /></td><td class='row1' align='right'>顶部面积</td><td class='row1' align='left'><input type='textbox' name='top_area" + poolNo + "' value='' /></td></tr><tr><td class='row1' align='right'>平均面积</td><td class='row1' align='left'><input type='textbox' name='middle_avg_water_area" + poolNo + "' value='' /></td><td class='row1' align='right'>平均边坡面积</td><td class='row1' align='left'><input type='textbox' name='avg_slope_HDPE_area" + poolNo + "' value='' /></td></tr><tr><td class='row1' align='right'>最小深度</td><td class='row1' align='left'><input type='textbox' name='Min_Depth" + poolNo + "' value='' /></td><td class='row1' align='right'>平均深度</td><td class='row1' align='left'><input type='textbox' name='Avg_Depth" + poolNo + "' value='' /></td></tr><tr><td class='row1' align='right'>平均最大深度</td><td class='row1' align='left'><input type='textbox' name='Avg_Depth_max" + poolNo + "' value='' /></td><td class='row1' align='right'>&nbsp;</td><td class='row1' align='left'>&nbsp;</td></tr><tr><td class='row1' align='right'>高程-面积数据</td><td class='row1' align='left'><textarea name='El_areas" + poolNo + "' value='' cols='15' rows='12'></textarea></td><td class='row1' align='right'>&nbsp;</td><td class='row1' align='left'>&nbsp;</td></tr></table>";

	        return htmlStr;
        }        
        
        function addPool() {
            poolNum++;
            $("#pools").append(getInnerHtml(poolNum));
            document.getElementById("totalPoolNum").value = poolNum;
        }

        function removePool(poolNo) {
            poolNum--;
            $("#pool" + poolNo).remove();
            document.getElementById("totalPoolNum").value = poolNum;
        }

        var ditchNum = <%: ditchNum%>;
        function getDitchInnerHtml(ditchNo)
        {
            var htmlStr = "<tr class='row1' id='ditch" + ditchNo + "'><th class='row1' style='padding-left:15px'>第" + ditchNo + "号截洪沟</th><td class='row1' style='padding-left:15px'>高程</td><td class='row1'><input type='textbox' value='' name='ditch_El" + ditchNo + "' /></td><td class='row1'>面积</td><td class='row1'><input type='textbox' value='' name='ditch_Area" + ditchNo + "' /></td><td class='row1'><a style='float:right;margin-right:5px' href='javascript:void(0);' onclick='removeDitch(" + ditchNo + ");'>X</a></td></tr>";

	        return htmlStr;
        }        
        
        function addDitch() {
            ditchNum++;
            $("#ditches").append(getDitchInnerHtml(ditchNum));
            document.getElementById("totalDitchNum").value = ditchNum;
        }

        function removeDitch(ditchNo) {
            ditchNum--;
            $("#ditch" + ditchNo).remove();
            document.getElementById("totalDitchNum").value = ditchNum;
        }



    </script>
</asp:Content>
